/**
 * 通用工具函数模块
 * 
 * 职责：
 * 1. 提供通用的工具函数
 * 2. 数据格式化和验证
 * 3. 数学计算和算法实现
 * 4. 号码属性查询
 * 5. 赔付计算辅助函数
 * 
 * @module Utils
 * @version 1.0.0
 * @since 2024-01-01
 */

import { colorConfig, oddsConfig, rulesConfig, animalConfig } from './config.js';
import { STATE } from './state.js';

/**
 * 通用工具类
 * 提供基础的工具函数和计算方法
 * 
 * @namespace CommonUtils
 */
export const CommonUtils = {
    /** @private ID生成计数器，确保唯一性 */
    _idCounter: 0,
    
    /**
     * 获取号码对应的颜色
     * 
     * @param {number} number - 号码 (1-49)
     * @returns {string} 颜色字符串 ('red', 'blue', 'green', '')
     * @example
     * const color = CommonUtils.getNumberColor(15);
     * console.log(color); // 'blue'
     */
    getNumberColor(number) {
        if (colorConfig.red.includes(number)) return 'red';
        if (colorConfig.blue.includes(number)) return 'blue';
        if (colorConfig.green.includes(number)) return 'green';
        return '';
    },
    
    /**
     * 格式化号码显示为两位数
     * 
     * @param {number} number - 号码
     * @returns {string} 格式化后的号码字符串
     * @example
     * const formatted = CommonUtils.formatNumber(5);
     * console.log(formatted); // '05'
     */
    formatNumber(number) {
        return number.toString().padStart(2, '0');
    },
    
    // 获取当前赔率
    getCurrentOdds(betType) {
        const gameConfig = oddsConfig[STATE.currentGame];
        if (!gameConfig) return 1;
        
        if (STATE.currentSub === 'liangmian' || STATE.currentSub.includes('lm')) {
            return gameConfig.liangmian[betType] || 1;
        }
        
        return gameConfig[STATE.currentSub] || 1;
    },
    
    // 获取当前规则文本
    getCurrentRules() {
        const gameRules = rulesConfig[STATE.currentGame];
        return gameRules ? gameRules[STATE.currentSub] || '' : '';
    },
    
    /**
     * 生成唯一ID
     * 使用时间戳+计数器+随机数确保唯一性
     * 
     * @returns {string} 唯一ID字符串
     * @example
     * const id = CommonUtils.generateId();
     * console.log(id); // '1640995200000_0001_5678'
     */
    generateId() {
        this._idCounter = (this._idCounter + 1) % 10000; // 防止计数器过大
        const timestamp = Date.now();
        const counter = this._idCounter.toString().padStart(4, '0');
        const random = Math.floor(Math.random() * 10000).toString().padStart(4, '0');
        return `${timestamp}_${counter}_${random}`;
    },
    
    // 获取玩法标识
    getGameTypeKey(game, sub) {
        return `${game}_${sub}`;
    },
    
    // 生成两面投注的详细gameTypeKey
    getSidesBetGameTypeKey(game, sub, betType, position) {
        if (position === 'tema') {
            return `tema_liangmian_${betType}`;
        } else {
            return `zhengma_zheng${position}lm_${betType}`;
        }
    },
    
    // 计算可中金额（已重构为使用统一的PayoutCalculator）
    calculatePotentialWin(bet) {
            // 使用统一计算器计算潜在赔付
        
        // 确保赔率存在
        if (!bet.odds && !bet.customOdds) {
            if (bet.type === 'numbers') {
                if (bet.game === 'lianma') {
                    bet.odds = this.getLianmaOdds(bet.sub);
                } else {
                    bet.odds = this.getCurrentOdds();
                }
            } else if (bet.type === 'banbo') {
                bet.odds = this.getBanboOdds(bet.banbo);
            } else {
                bet.odds = 1;
            }
            // 自动设置赔率
        }
        
        // 强制使用统一的赔付计算器
        const result = window.PayoutCalculator.calculatePotentialPayout(bet);
            
        // 统一计算器计算完成
        return result;
    },
    

    
    // 防抖函数
    debounce(func, wait) {
        let timeout;
        return function executedFunction(...args) {
            const later = () => {
                clearTimeout(timeout);
                func(...args);
            };
            clearTimeout(timeout);
            timeout = setTimeout(later, wait);
        };
    },
    
    // 获取彩票名称
    getLotteryName(lottery) {
        const names = {
            'hk': '香港六合彩',
            'macau-new': '新澳门六合彩',
            'macau': '澳门六合彩'
        };
        return names[lottery] || '香港六合彩';
    },
    
    // 获取状态文本
    getStatusText(status) {
        const statusMap = {
            'pending': '待开奖',
            'win': '已中奖',
            'lose': '未中奖'
        };
        return statusMap[status] || status;
    },
    
    // 获取玩法显示名称
    getGameTypeDisplayName(gameTypeKey) {
        const nameMap = {
            'tema_zhixuan': '特码直选',
            'tema_liangmian_da': '特码大',
            'tema_liangmian_xiao': '特码小',
            'tema_liangmian_dan': '特码单',
            'tema_liangmian_shuang': '特码双',
            'tema_liangmian_heda': '特码合大',
            'tema_liangmian_hexiao': '特码合小',
            'tema_liangmian_hedan': '特码合单',
            'tema_liangmian_heshuang': '特码合双',
            'tema_liangmian_weida': '特码尾大',
            'tema_liangmian_weixiao': '特码尾小',
            'tema_liangmian_jiaqin': '特码家禽',
            'tema_liangmian_yeshou': '特码野兽',
            'zhengma_renxuan': '正码任选',
            'zhengma_zheng1te': '正码1特',
            'zhengma_zheng2te': '正码2特',
            'zhengma_zheng3te': '正码3特',
            'zhengma_zheng4te': '正码4特',
            'zhengma_zheng5te': '正码5特',
            'zhengma_zheng6te': '正码6特'
        };
        
        // 处理正码两面的动态key
        if (gameTypeKey.startsWith('zhengma_zheng') && gameTypeKey.includes('lm_')) {
            const parts = gameTypeKey.split('_');
            const position = parts[1].replace('zheng', '').replace('lm', '');
            const betType = parts[2];
            const betTypeMap = {
                'da': '大', 'xiao': '小', 'dan': '单', 'shuang': '双',
                'heda': '合大', 'hexiao': '合小', 'hedan': '合单', 'heshuang': '合双',
                'weida': '尾大', 'weixiao': '尾小', 'jiaqin': '家禽', 'yeshou': '野兽'
            };
            return `正码${position}${betTypeMap[betType] || betType}`;
        }
        
        return nameMap[gameTypeKey] || gameTypeKey;
    },
    
    /**
     * 计算组合数 C(n, r) = n! / (r! * (n-r)!)
     * 
     * @param {number} n - 总数
     * @param {number} r - 选择数
     * @returns {number} 组合数
     * @example
     * const combinations = CommonUtils.calculateCombination(5, 2);
     * console.log(combinations); // 10
     */
    calculateCombination(n, r) {
        if (r > n || r < 0) return 0;
        if (r === 0 || r === n) return 1;
        
        // 优化计算，选择较小的r值
        r = Math.min(r, n - r);
        
        let result = 1;
        for (let i = 0; i < r; i++) {
            result = result * (n - i) / (i + 1);
        }
        
        return Math.round(result);
    },
    
    // 计算连码注数
    calculateLianmaCount(numbers, subType) {
        const count = numbers.length;
        
        switch (subType) {
            case 'sanquanzhong': // 三全中：C(n, 3)
                return count >= 3 ? this.calculateCombination(count, 3) : 0;
                
            case 'sanzhonger': // 三中二：C(n, 3)
                return count >= 3 ? this.calculateCombination(count, 3) : 0;
                
            case 'erquanzhong': // 二全中：C(n, 2)
                return count >= 2 ? this.calculateCombination(count, 2) : 0;
                
            case 'erzhongte': // 二中特：C(n, 2)
                return count >= 2 ? this.calculateCombination(count, 2) : 0;
                
            case 'techuan': // 特串：C(n, 2)
                return count >= 2 ? this.calculateCombination(count, 2) : 0;
                
            default:
                return 0;
        }
    },
    
    // 获取连码赔率
    getLianmaOdds(subType) {
        const lianmaOdds = oddsConfig.lianma;
        if (!lianmaOdds) return 1;
        
        switch (subType) {
            case 'sanquanzhong':
                return lianmaOdds.sanquanzhong;
            case 'sanzhonger':
                return lianmaOdds.sanzhonger;
            case 'erquanzhong':
                return lianmaOdds.erquanzhong;
            case 'erzhongte':
                return lianmaOdds.erzhongte.erzhong; // 默认返回二中赔率
            case 'techuan':
                return lianmaOdds.techuan;
            default:
                return 1;
        }
    },
    
    // 获取半波赔率
    getBanboOdds(banboType) {
        const banboOdds = oddsConfig.banbo;
        if (!banboOdds) return 1;
        return banboOdds[banboType] || 1;
    },
    
    // 获取半波名称
    getBanboName(banboType) {
        const nameMap = {
            'red_big': '红大',
            'red_small': '红小',
            'red_odd': '红单',
            'red_even': '红双',
            'red_sum_odd': '红合单',
            'red_sum_even': '红合双',
            'green_big': '绿大',
            'green_small': '绿小',
            'green_odd': '绿单',
            'green_even': '绿双',
            'green_sum_odd': '绿合单',
            'green_sum_even': '绿合双',
            'blue_big': '蓝大',
            'blue_small': '蓝小',
            'blue_odd': '蓝单',
            'blue_even': '蓝双',
            'blue_sum_odd': '蓝合单',
            'blue_sum_even': '蓝合双'
        };
        return nameMap[banboType] || banboType;
    }
};

// 正码两面投注规则计算
export const ZhengmaRules = {
    isDa: (number) => number >= 25,
    isXiao: (number) => number <= 24,
    isDan: (number) => number % 2 === 1,
    isShuang: (number) => number % 2 === 0,
    getHeSum: (number) => Math.floor(number / 10) + (number % 10),
    isHeDa: (number) => ZhengmaRules.getHeSum(number) > 6,
    isHeXiao: (number) => ZhengmaRules.getHeSum(number) <= 6,
    isHeDan: (number) => ZhengmaRules.getHeSum(number) % 2 === 1,
    isHeShuang: (number) => ZhengmaRules.getHeSum(number) % 2 === 0,
    getTail: (number) => number % 10,
    isWeiDa: (number) => ZhengmaRules.getTail(number) > 4,
    isWeiXiao: (number) => ZhengmaRules.getTail(number) <= 4,
    isHe: (number) => number === 49
};

// 半波投注规则计算
export const BanboRules = {
    // 获取号码的波色
    getColor(number) {
        return CommonUtils.getNumberColor(number);
    },
    
    // 判断大小
    isBig(number) {
        return number >= 25;
    },
    
    isSmall(number) {
        return number <= 24;
    },
    
    // 判断单双
    isOdd(number) {
        return number % 2 === 1;
    },
    
    isEven(number) {
        return number % 2 === 0;
    },
    
    // 计算合数
    getSum(number) {
        return Math.floor(number / 10) + (number % 10);
    },
    
    // 判断合数单双
    isSumOdd(number) {
        return this.getSum(number) % 2 === 1;
    },
    
    isSumEven(number) {
        return this.getSum(number) % 2 === 0;
    },
    
    // 检查号码是否属于指定半波
    isBanboMatch(number, banboType) {
        const [color, type] = banboType.split('_');
        
        // 检查波色
        if (this.getColor(number) !== color) {
            return false;
        }
        
        // 检查类型
        switch (type) {
            case 'big':
                return this.isBig(number);
            case 'small':
                return this.isSmall(number);
            case 'odd':
                return this.isOdd(number);
            case 'even':
                return this.isEven(number);
            case 'sum':
                // 处理合单合双的情况
                if (banboType.includes('sum_odd')) {
                    return this.isSumOdd(number);
                } else if (banboType.includes('sum_even')) {
                    return this.isSumEven(number);
                }
                return false;
            default:
                return false;
        }
    },
    
    // 获取半波包含的号码列表
    getBanboNumbers(banboType) {
        const [color, type] = banboType.split('_');
        const colorNumbers = colorConfig[color] || [];
        
        return colorNumbers.filter(number => {
            switch (type) {
                case 'big':
                    return this.isBig(number);
                case 'small':
                    return this.isSmall(number);
                case 'odd':
                    return this.isOdd(number);
                case 'even':
                    return this.isEven(number);
                default:
                    // 处理合单合双
                    if (banboType.includes('sum_odd')) {
                        return this.isSumOdd(number);
                    } else if (banboType.includes('sum_even')) {
                        return this.isSumEven(number);
                    }
                    return false;
            }
        });
    },
    
    // 检查中奖
    checkBanboWin(selectedBanbos, winningNumber) {
        return selectedBanbos.filter(banbo => {
            return this.isBanboMatch(winningNumber, banbo);
        });
    }
};

// 尾数工具类
export const TailUtils = {
    // 生成组合
    generateCombinations(array, size) {
        if (size > array.length) return [];
        if (size === 1) return array.map(item => [item]);
        
        const combinations = [];
        for (let i = 0; i <= array.length - size; i++) {
            const head = array[i];
            const tailCombinations = this.generateCombinations(array.slice(i + 1), size - 1);
            for (const tail of tailCombinations) {
                combinations.push([head, ...tail]);
            }
        }
        return combinations;
    },

    // 获取号码的尾数
    getTailNumber(number) {
        return number % 10;
    },

    // 获取号码的头数(十位)
    getHeadNumber(number) {
        return Math.floor(number / 10);
    },

    // 检查特码头尾中奖
    checkTematoweiWin(betTails, betTailType, drawNumbers) {
        const tema = drawNumbers[6]; // 特码是第7个号码
        
        if (betTailType === 'head') {
            // 检查头数
            const temaHead = this.getHeadNumber(tema);
            return betTails.includes(temaHead.toString());
        } else {
            // 检查尾数
            const temaTail = this.getTailNumber(tema);
            return betTails.includes(temaTail.toString());
        }
    },

    // 检查连尾中奖
    checkLianweiWin(betTails, drawNumbers, subType, tailCombinations = null) {
        // 获取所有开奖号码的尾数
        const allTails = drawNumbers.map(num => this.getTailNumber(num).toString());
        
        if (tailCombinations && tailCombinations.length > 0) {
            // 合并投注：检查是否有任何一个组合中奖
            return tailCombinations.some(combination => {
                return combination.every(tail => allTails.includes(tail));
            });
        } else {
            // 单个组合投注：检查投注的尾数组合是否全部在开奖尾数中
            return betTails.every(tail => allTails.includes(tail));
        }
    },

    // 检查正特尾数中奖
    checkZhengteweishuWin(betTails, drawNumbers) {
        // 获取所有开奖号码（正码+特码）的尾数
        const allTails = drawNumbers.map(num => this.getTailNumber(num).toString());
        
        // 检查投注的尾数是否在开奖尾数中
        return betTails.some(tail => allTails.includes(tail));
    }
};

// 生肖相关工具函数
export const AnimalUtils = {
    // 根据号码获取生肖
    getAnimalByNumber(number) {
        return animalConfig.getAnimalByNumber(number);
    },

    // 根据ID获取生肖
    getAnimalById(id) {
        return animalConfig.getAnimalById(id);
    },

    // 生成组合
    generateCombinations(items, size) {
        if (size > items.length || size <= 0) {
            return [];
        }
        
        if (size === 1) {
            return items.map(item => [item]);
        }
        
        const combinations = [];
        
        for (let i = 0; i < items.length - size + 1; i++) {
            const head = items[i];
            const tailCombinations = this.generateCombinations(items.slice(i + 1), size - 1);
            
            for (const tail of tailCombinations) {
                combinations.push([head, ...tail]);
            }
        }
        
        return combinations;
    },

    // 计算组合数
    combination(n, r) {
        return CommonUtils.calculateCombination(n, r);
    },

    // 检查特肖中奖
    checkTexiaoWin(selectedAnimals, temaNumber) {
        const temaAnimal = this.getAnimalByNumber(temaNumber);
        if (!temaAnimal) return false;
        
        return selectedAnimals.includes(temaAnimal.id);
    },

    // 检查一肖中奖
    checkYixiaoWin(selectedAnimals, allNumbers) {
        const allAnimals = allNumbers.map(num => this.getAnimalByNumber(num)).filter(Boolean);
        const uniqueAnimalIds = [...new Set(allAnimals.map(animal => animal.id))];
        
        return selectedAnimals.some(animalId => uniqueAnimalIds.includes(animalId));
    },

    // 检查连肖中奖
    checkLianxiaoWin(selectedAnimals, allNumbers, combinationSize) {
        const allAnimals = allNumbers.map(num => this.getAnimalByNumber(num)).filter(Boolean);
        const uniqueAnimalIds = [...new Set(allAnimals.map(animal => animal.id))];
        
        // 检查是否包含所有选中的生肖
        return selectedAnimals.every(animalId => uniqueAnimalIds.includes(animalId));
    },

    // 检查正肖中奖（基于正码，不含特码）
    checkZhengxiaoWin(selectedAnimals, zhengmaNumbers) {
        const zhengmaAnimals = zhengmaNumbers.map(num => this.getAnimalByNumber(num)).filter(Boolean);
        const uniqueAnimalIds = [...new Set(zhengmaAnimals.map(animal => animal.id))];
        
        // 计算匹配的正码数量
        const matchCount = selectedAnimals.filter(animalId => uniqueAnimalIds.includes(animalId)).length;
        
        return {
            isWin: matchCount > 0,
            matchCount: matchCount,
            multiplier: matchCount // 倍增系数
        };
    },

    // 检查合肖中奖
    checkHexiaozhongWin(selectedAnimals, temaNumber) {
        // 49号码和局
        if (temaNumber === 49) {
            return { isWin: false, isHe: true }; // 和局
        }
        
        const temaAnimal = this.getAnimalByNumber(temaNumber);
        if (!temaAnimal) return { isWin: false, isHe: false };
        
        const isWin = selectedAnimals.includes(temaAnimal.id);
        return { isWin: isWin, isHe: false };
    },

    // 检查合肖不中中奖
    checkHexiaobuzhongWin(selectedAnimals, temaNumber) {
        // 49号码和局
        if (temaNumber === 49) {
            return { isWin: false, isHe: true }; // 和局
        }
        
        const temaAnimal = this.getAnimalByNumber(temaNumber);
        if (!temaAnimal) return { isWin: true, isHe: false }; // 如果没有对应生肖，算不中
        
        const isWin = !selectedAnimals.includes(temaAnimal.id); // 反向逻辑
        return { isWin: isWin, isHe: false };
    },

    // 检查总肖中奖
    checkZongxiaoWin(zongxiaoType, allNumbers) {
        const allAnimals = allNumbers.map(num => this.getAnimalByNumber(num)).filter(Boolean);
        const uniqueAnimalIds = [...new Set(allAnimals.map(animal => animal.id))];
        const totalCount = uniqueAnimalIds.length;
        
        switch (zongxiaoType) {
            case '234xiao':
                return totalCount === 2 || totalCount === 3 || totalCount === 4;
            case '5xiao':
                return totalCount === 5;
            case '6xiao':
                return totalCount === 6;
            case '7xiao':
                return totalCount === 7;
            case 'dan':
                return totalCount % 2 === 1;
            case 'shuang':
                return totalCount % 2 === 0;
            default:
                return false;
        }
    },

    // 计算正肖派彩
    calculateZhengxiaoPayout(bet, matchCount) {
        const baseOdds = bet.odds;
        const multiplier = matchCount;
        return bet.amount * baseOdds * multiplier;
    },

    // 获取生肖名称列表
    getAnimalNames(animalIds) {
        return animalIds.map(id => this.getAnimalById(id)?.name).filter(Boolean);
    }
};

    // 将AnimalUtils的方法添加到CommonUtils中，以便统一调用
CommonUtils.generateCombinations = AnimalUtils.generateCombinations.bind(AnimalUtils);
CommonUtils.combination = AnimalUtils.combination.bind(AnimalUtils);

// 添加生肖获取函数到CommonUtils
CommonUtils.getShengxiao = function(number) {
    const animal = AnimalUtils.getAnimalByNumber(number);
    return animal ? animal.name : null;
};

// 不中工具类
export const BuzhongUtils = {
    // 检查不中中奖
    checkBuzhongWin(betNumbers, drawNumbers, subType) {
        // 获取组合大小
        const combinationSizeMap = {
            'wubuzhong': 5,
            'liubuzhong': 6,
            'qibuzhong': 7,
            'babuzhong': 8,
            'jiubuzhong': 9,
            'shibuzhong': 10
        };
        
        const combinationSize = combinationSizeMap[subType];
        if (!combinationSize) return false;
        
        // 生成所有可能的组合
        const combinations = this.generateCombinations(betNumbers, combinationSize);
        
        // 检查是否有组合完全不在开奖号码中
        return combinations.some(combination => {
            return combination.every(num => !drawNumbers.includes(num));
        });
    },

    // 生成组合
    generateCombinations(numbers, size) {
        if (size > numbers.length) return [];
        if (size === 1) return numbers.map(num => [num]);
        
        const combinations = [];
        
        function backtrack(start, currentCombination) {
            if (currentCombination.length === size) {
                combinations.push([...currentCombination]);
                return;
            }
            
            for (let i = start; i < numbers.length; i++) {
                currentCombination.push(numbers[i]);
                backtrack(i + 1, currentCombination);
                currentCombination.pop();
            }
        }
        
        backtrack(0, []);
        return combinations;
    },

    // 获取中奖的组合
    getWinningCombinations(betNumbers, drawNumbers, subType) {
        const combinationSizeMap = {
            'wubuzhong': 5,
            'liubuzhong': 6,
            'qibuzhong': 7,
            'babuzhong': 8,
            'jiubuzhong': 9,
            'shibuzhong': 10
        };
        
        const combinationSize = combinationSizeMap[subType];
        if (!combinationSize) return [];
        
        const combinations = this.generateCombinations(betNumbers, combinationSize);
        
        // 返回所有不在开奖号码中的组合
        return combinations.filter(combination => {
            return combination.every(num => !drawNumbers.includes(num));
        });
    }
};

// 色波工具类
export const SeboUtils = {
    // 计算色波得分
    calculateSeboScores(zhengmaNumbers, temaNumber) {
        let redScore = 0;
        let greenScore = 0;
        let blueScore = 0;
        
        // 正码各计1分
        zhengmaNumbers.forEach(number => {
            const color = CommonUtils.getNumberColor(number);
            if (color === 'red') redScore += 1;
            else if (color === 'green') greenScore += 1;
            else if (color === 'blue') blueScore += 1;
        });
        
        // 特码计1.5分
        const temaColor = CommonUtils.getNumberColor(temaNumber);
        if (temaColor === 'red') redScore += 1.5;
        else if (temaColor === 'green') greenScore += 1.5;
        else if (temaColor === 'blue') blueScore += 1.5;
        
        return { red: redScore, green: greenScore, blue: blueScore };
    },
    
    // 检查是否为和局
    checkSeboHe(zhengmaNumbers, temaNumber) {
        const scores = this.calculateSeboScores(zhengmaNumbers, temaNumber);
        
        // 检查三种和局情况
        // 1. 6个正码开出3蓝3绿，特别码是1.5红
        if (scores.blue === 3 && scores.green === 3 && scores.red === 1.5) return true;
        
        // 2. 6个正码开出3蓝3红，特别码是1.5绿
        if (scores.blue === 3 && scores.red === 3 && scores.green === 1.5) return true;
        
        // 3. 6个正码开出3绿3红，特别码是1.5蓝
        if (scores.green === 3 && scores.red === 3 && scores.blue === 1.5) return true;
        
        return false;
    },
    
    // 检查色波中奖
    checkSeboWin(seboType, zhengmaNumbers, temaNumber) {
        // 检查是否为和局
        const isHe = this.checkSeboHe(zhengmaNumbers, temaNumber);
        
        if (seboType === 'he') {
            // 投注"和"，和局即中奖
            return { isWin: isHe, isHe: isHe };
        } else {
            // 投注红/绿/蓝波
            if (isHe) {
                // 和局退本金
                return { isWin: false, isHe: true };
            } else {
                // 计算各色波得分
                const scores = this.calculateSeboScores(zhengmaNumbers, temaNumber);
                
                // 找出得分最高的颜色
                const maxScore = Math.max(scores.red, scores.green, scores.blue);
                let winningColors = [];
                
                if (scores.red === maxScore) winningColors.push('hongbo');
                if (scores.green === maxScore) winningColors.push('lvbo');
                if (scores.blue === maxScore) winningColors.push('lanbo');
                
                // 检查投注的色波是否中奖
                const isWin = winningColors.includes(seboType);
                return { isWin: isWin, isHe: false, winningColors: winningColors, scores: scores };
            }
        }
    },
    
    // 获取色波名称
    getSeboName(seboType) {
        const nameMap = {
            'hongbo': '红波',
            'lvbo': '绿波',
            'lanbo': '蓝波',
            'he': '和'
        };
        return nameMap[seboType] || seboType;
    }
}; 